//  mockProdServer.ts

import { createProdMockServer } from 'vite-plugin-mock/client';

// Import your mock .ts files one by one
// If you use vite.mock.config.ts, just import the file directly
// You can use the import.meta.glob function to import all

const modules = import.meta.glob('./mock/**/*.ts', {
  eager: true,
  import: 'default',
});
const mockList: any[] = [];

Object.keys(modules).forEach(key => {
  const mod = modules[key] || {};
  const modList = Array.isArray(mod) ? [...mod] : [mod];
  mockList.push(...modList);
});
export function setupProdMockServer() {
  createProdMockServer([...[...mockList]]);
}
